<?php
use yii\helpers\Html;
$post=\Yii::$app->session->getFlash('post');
?>
<?php $this->beginBlock('title'); ?>
    <?php if(isset($model['state_id'])):?>编辑<?php else:?>新增<?php endif;?>游戏状态
<?php $this->endBlock();?>
<?php $this->beginBlock('breadcrumb'); ?>
<li><a href="<?php echo \Yii::$app->urlManager->createUrl('/game-state/index')?>">游戏状态</a></li>
<li class="active"><a href="<?php echo \Yii::$app->urlManager->createUrl('/game-state/edit',['state_id'=>isset($model['state_id'])?$model['state_id']:0]);?>"><?php if(isset($model['state_id'])):?>编辑<?php else:?>新增<?php endif;?>游戏链接</a></li>
<?php $this->endBlock();?>

<div class="row">
	<div class="col-sm-12">
		<section class="panel">
			<div class="panel-body">
				<div class="form">
					<form class="cmxform form-horizontal tasi-form" method="post" action="<?php echo \Yii::$app->urlManager->createUrl('/game-state/save');?>">
						<div class="form-group">
							<label for="state_name" class="control-label col-lg-2">名称</label>
							<div class="col-lg-10">
                               	<input class="form-control" id="state_name" name="state_name" value="<?php if(isset($post['state_name'])){ echo $post['state_name'];}else{ echo Html::encode(isset($model['state_name'])?$model['state_name']:''); }?>" type="text" required />
                            </div>
						</div>
                        <div class="form-group">
                            <label for="alias" class="control-label col-lg-2">别名</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="alias" type="text" value="<?php if(isset($post['alias'])){ echo $post['alias'];}else{ echo Html::encode(isset($model['alias'])?$model['alias']:''); }?>" name="alias" required />
                            </div>
                        </div>
                        <?php if(isset($model['state_id'])):?>
                        <div class="form-group">
                            <label for="game_count" class="control-label col-lg-2">游戏数量</label>
                            <div class="col-lg-10">
                                <input class="form-control " id="game_count" type="text" disabled="" value="<?php if(isset($post['game_count'])){ echo $post['game_count'];}else{ echo Html::encode(isset($model['game_count'])?$model['game_count']:''); }?>" name="game_count" />
                            </div>
                        </div>
                        <?php endif;?>
                        <div class="form-group">
                            <div class="col-lg-offset-2 col-lg-10">
                                <input type="hidden" name="_csrf" id="_csrf" value="<?=\Yii::$app->request->csrfToken; ?>" />
        						<?php if(isset($model['state_id'])):?><input type="hidden" name="state_id" value="<?=$model['state_id'];?>" /><?php endif;?>
                                <button class="btn btn-success" type="submit"> 保存</button>
                                <button class="btn btn-default" type="button" onclick="javascript:history.go(-1)"> 取消</button>
                            </div>
                        </div>
                    </form>
                </div>
			</div>
		</section>
	</div>
</div>